FROM golang:1.19 as build

LABEL maintainer="infinitedemon@foxmail.com"

ENV CGO_ENABLED 0
ENV GOOS linux
ENV GOARCH amd64
ENV GOPROXY "https://goproxy.cn,direct"
ENV GO111MODULE on

WORKDIR /go/cache

ADD go.mod .
ADD go.sum .

RUN go mod download

WORKDIR /go/release

#RUN go mod vendor

COPY . .

#ARG AppDir

RUN go build -ldflags="-s -w" -o ./app ./cmd/main.go

FROM dc01.iotdreamcatcher.net.cn:6443/public/goalpine as prod

EXPOSE 8080

COPY --from=build /go/release/app /app

ENTRYPOINT ["/app"]